Skip to content

feat: require explicit activation of Anchor runtime (fixes #25)#35

Merged
Tanishq1030 merged 1 commit into
mainfrom
feature/issue-25-explicit-activation
Jul 10, 2026
Merged

feat: require explicit activation of Anchor runtime (fixes #25)#35
Tanishq1030 merged 1 commit into
mainfrom
feature/issue-25-explicit-activation

Conversation

@Tanishq1030

Copy link
Copy Markdown
Member

Description

This PR removes the automatic, import-time side-effects of importing anchor.runtime by separating module import from SDK activation, requiring an explicit anchor.runtime.activate() call.

Acceptance Criteria

  • Remove automatic activation during module import.
  • Require an explicit activate() call.
  • Prevent monkeypatching until activation occurs.
  • Update documentation and examples to use explicit activation.
  • Preserve existing runtime behavior after activation.

Changes

  • Runtime SDK Entrypoint (anchor/runtime/__init__.py):
    • Removed the automatic import-time invocation of activate() and _load_custom_providers_from_policy().
    • Moved custom provider policy loading inside the activate() method, ensuring policy settings are successfully loaded when the SDK is explicitly enabled.
    • Updated the module's docstring reference examples to instruct developers on using explicit activation.
  • Smoke Test Suite (tests/runtime/test_runtime_interceptors.py):
    • Updated the tests to assert that rt.get_session_stats()["status"] is "inactive" immediately after import.
    • Verifies that the status changes to "active" and interceptor monkeypatching is configured after rt.activate() is explicitly called.
  • Documentation & Integration Examples: Confirmed that all built-in examples (e.g. python-openai-app.md, langchain-agent.md, installation.md) are already fully compliant with the explicit activation pattern.

Related Issues

Fixes #25

Copilot AI review requested due to automatic review settings July 10, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Tanishq1030
Tanishq1030 merged commit fcf1714 into main Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require Explicit Runtime Activation Instead of Import-Time Monkeypatching

2 participants